package com.agentai.framework.thread;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * <p>
 *
 * </p>
 *
 * @author bianruhao
 * @since 2024-09-06 16:58
 */
public class CustomRejectedExecutionHandler implements RejectedExecutionHandler {

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        if (!executor.isShutdown()) {
            // 自定义处理逻辑
            System.out.println("Task " + r.toString() + " was rejected.");
            // 可以记录日志、发送告警等
        }
    }

}
